// 员工模块


import request from '@/utils/request'
// 获取员工列表接口
export const getStaffService = (params) => {
    return request.get('/sys/user', { 
        params
    })
}

// 员工列表导出接口
export const getExportListService = () => {
    return request.get('/sys/user/export', {
        // 返回的接口是二进制流,使用blob格式接收二进制流
        responseType: 'blob'
    })
}

// 下载导入模板接口
export const getTempService = () => {
    return request.get('/sys/user/import/template',{ 
       responseType: 'blob'
   })
}

// 上传文件接口
export const getUploadService = (data) =>{
    return request.post('/sys/user/import', data)
}

// 删除员工接口
export const getDelService = (id) => {
    return request.delete(`/sys/user/${id}`)
}

// 新增员工接口
export const getAddStaffService = (data) => {
    return request.post('/sys/user', data)
}

// 查询员工、获取员工基本信息接口
export const getInfoService = (id) => {
    return request.get(`/sys/user/${id}`)
}

// 编辑员工接口
export const getExitService =(data) => {
    return request.put(`/sys/user/${data.id}`,data)
}

// 获取已启用的角色列表的接口
export const getRoleListService = () => request.get('/sys/role/list/enabled')

// 员工分配角色接口
export const getStaffRoleService = (data) => request.put('/sys/user/assignRoles', data)
